package com.ruoyi.center.demo.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.center.demo.convert.DemoConverter;
import com.ruoyi.center.demo.api.dto.DemoDto;
import com.ruoyi.center.demo.mapper.DemoMapper;
import com.ruoyi.center.demo.domain.DemoDo;
import com.ruoyi.center.demo.service.DemoService;
import com.ruoyi.common.core.utils.PageUtils;
import com.ruoyi.common.core.web.page.PageResultDto;
import org.springframework.stereotype.Service;

/**
 * demo Service业务层处理
 *
 * @author ruoyi
 * @date 2021-12-24
 */
@Service
public class DemoServiceImpl extends ServiceImpl<DemoMapper, DemoDo> implements DemoService {

    @Override
    public PageResultDto<DemoDto> queryPage(Long pageNum, Long pageSize, DemoDto demoDto) {
        IPage page = getBaseMapper().selectPage(PageUtils.getPage(),
                DemoConverter.buildWrapper(demoDto));
        return new PageResultDto(DemoConverter.
                doList2DtoList(page.getRecords()),page.getTotal());
    }
}
